package com.qf.java2105.huangchuang.hotel.entity;

import java.util.List;

/**
 * 分页实体
 * @author hcvg
 * @version v1.0
 * @date 2021/09/15
 **/
public class PageBean<T> {
    /**
     * 集合
     */
    private List<T> list;

    /**
     * 当前页，默认为1
     */
    private Integer currentPage = 1;

    /**
     * 总页数
     */
    private Integer totalPage;

    /**
     * 总数量
     */
    private Long totalCount;

    /**
     * 分页每页的数量
     */
    private Integer pageSize = 6;

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        if (null == currentPage || currentPage <= 0){
            currentPage = 1;
        }
        this.currentPage = currentPage;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage() {
        Integer count = this.totalCount.intValue();
        this.totalPage = count % this.pageSize == 0 ? count / this.pageSize : count / this.pageSize + 1;
    }

    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
